home *** CD-ROM | disk | FTP | other *** search
/ W95 Shareware Collection / W95 Collection - Windows 95 Shareware (LCDCAN).iso / win95 / utils / chief200 / chiefpro.chf < prev    next >
Text File  |  1995-09-15  |  6KB  |  155 lines

  1. REM ROUGH AND READY SAMPLE CHIEFPRO BATCH FILE
  2. REM TRIES TO USE A LOT OF THE BATCH LANGUAGE FEATURES!!
  3. REM ---------------------------------------------------
  4.  
  5. REM --- ERRORCODE  0  means success
  6. REM --- ERRORCODE  1  means a syntax error
  7. REM --- ERRORCODE -1  means some other processing error
  8.  
  9. REM --- First, let's define some constants for use later on
  10.  
  11. #CONST T_FILE=$DEST\CHFTEST.TXT
  12. #CONST Question1="Should I run NOTEPAD?"
  13. #CONST Question2="Should I abort this Batch Demo now?"
  14. #CONST Question3="Do you want to see a test run of a sample\nChief Pro batch file?"
  15. #CONST Question4="Do you want to see a modeless dialog box\nfor continuous messages?"
  16. #CONST Prompt1="Please Enter a parameter for Windows WRITE:\nor, Click on Cancel to skip this:"
  17.  
  18. REM --- ask user for confirmation
  19. REM IF NOT-CONFIRM "Do you want to see a test run of a sample\nChief Pro batch file ?" GOTO NO-DEMO
  20. REM IF NOT-CONFIRM "Do you want to see a modeless dialog box\nfor continuous messages ?" GOTO THE-REST
  21.  
  22. IF NOT-CONFIRM Question3 GOTO NO-DEMO
  23. IF NOT-CONFIRM Question4 GOTO THE-REST
  24.  
  25. :SHOW-DIALOG
  26. REM - display a message on a modeless dialog
  27. SAY You will now see a modeless message dialog ...
  28. DISPLAY Writing to T_FILE Please wait ...
  29. DELAY 4
  30.  
  31. REM --- create the file; do this if you want uninstaller to be able to
  32. REM --- to remove it later on, else, it is not necessary to use CREATEFILE
  33. IF NOT-EXIST T_FILE CREATEFILE T_FILE
  34. IF ERRORCODE -1 GOTO THE-REST
  35.  
  36. REM --- remove READONLY file attribute
  37. ATTRIB T_FILE;-R
  38. IF ERRORCODE -1 GOTO THE-REST
  39.  
  40. REM --- write entries into the file
  41. APPENDFILE T_FILE REM ------------------- entry by ChiefPro -----------------
  42. IF ERRORCODE -1 SAY I could not write the entry!
  43. APPENDFILE T_FILE Ok then. Let us see what we all can do!
  44. IF ERRORCODE -1 SAY I could not write the entry!
  45. WRITETEXT T_FILE;1;This is the first line
  46. IF ERRORCODE -1 SAY I could not write the entry!
  47. WRITETEXT T_FILE;last;This is the last line
  48. IF ERRORCODE -1 SAY I could not write the entry!
  49. WRITETEXT T_FILE;4;This is the 4th line
  50. IF ERRORCODE -1 SAY I could not write the entry!
  51. WRITETEXT T_FILE;155;This is the real last (or 155th) line
  52. IF ERRORCODE -1 SAY I could not write the entry!
  53.  
  54. REM --- set the HIDDEN and READONLY file attribute bits
  55. ATTRIB T_FILE;+H;+R
  56. IF ERRORCODE 0 SAY I have now set T_FILE attibute bits \nto READONLY and HIDDEN
  57.  
  58. REM - turn off the display dialog
  59. DISPLAY OFF
  60. SAY The display dialog has now been turned off!
  61.  
  62. REM turn on the display dialog again ....
  63. DISPLAY The display dialog is on again!\n\nPlease wait, I am still working hard ...
  64.  
  65. REM --- remove READONLY, HIDDEN, and ARCHIVE file attribute bits
  66. ATTRIB T_FILE;-R;-H;-A
  67. IF ERRORCODE 0 SAY I have now removed the READONLY and HIDDEN \nattribute bits from T_FILE
  68.  
  69. :THE-REST
  70. REM ---- make a directory, et. al.
  71. MD $TEMPDIR\CHIEFPRO
  72. IF ERRORCODE 0 COPY $DEST\SAMPLES\CHIEFPRO.CHF $TEMPDIR\CHIEFPRO
  73. IF ERRORCODE 0 SAY I copied the test file!
  74. IF EXIST $TEMPDIR\CHIEFPRO\*.CHF SAY The test file IS there!
  75. IF EXIST $TEMPDIR\CHIEFPRO\*.CHF DEL $TEMPDIR\CHIEFPRO\CHIEFPRO.CHF
  76. IF ERRORCODE 0 SAY I Deleted the test file!
  77. IF ISDIRECTORY $TEMPDIR\CHIEFPRO RD $TEMPDIR\CHIEFPRO
  78. IF ERRORCODE 0 SAY I Deleted the test directory!
  79.  
  80. REM --- ask for user INPUT
  81. REM IF INPUT "Please Enter a parameter for Windows WRITE\nOr, Click on Cancel" EXECWAIT WRITE.EXE INPUT
  82. IF INPUT Prompt1 EXECWAIT WRITE.EXE INPUT
  83.  
  84. REM --- ask user for confirmation
  85. REM IF CONFIRM "Should I RUN Notepad?" EXECWAIT notepad
  86. IF CONFIRM Question1 EXECWAIT notepad
  87.  
  88. REM --- various Video display modes, et. al.
  89. IF VMODE VGA ECHO Your video display driver is VGA!
  90. IF VMODE SVGA ECHO Your video display driver is SuperVGA!
  91. IF VMODE SSVGA ECHO Your video display driver is \n1024 * 768 or higher!
  92.  
  93. REM --- Various Windows versions, et. al.
  94. IF WINVER 3.10  SAY Your Windows Version is 3.10
  95. IF WINVER 3.11  SAY Your Windows Version is 3.11 \n(no network)
  96. IF WINVER NT    SAY Your Windows Version is Windows NT
  97. IF WINVER 95    SAY Your Windows Version is Windows 95
  98.  
  99. REM - using numeric codes [1 to 11]
  100. IF WINVER 1  SAY Your Windows Version is 3.00
  101. IF WINVER 2  SAY Your Windows Version is 3.10 \n(no network)
  102. IF WINVER 3  SAY Your Windows Version is 3.10 \n(with network)
  103. IF WINVER 4  SAY Your Windows Version is 3.10 \n(with Win32s, no network)
  104. IF WINVER 5  SAY Your Windows Version is 3.10 \n(with Win32s, and network)
  105. IF WINVER 6  SAY Your Windows Version is 3.11 \n(no network)
  106. IF WINVER 7  SAY Your Windows Version is 3.11WG \n(with Network)
  107. IF WINVER 8  SAY Your Windows Version is 3.11 \nwith Win32s
  108. IF WINVER 9  SAY Your Windows Version is 3.11 \n(with network and Win32s)
  109. IF WINVER 10 SAY Your Windows Version is Windows 95
  110. IF WINVER 11 SAY Your Windows Version is Windows NT
  111.  
  112. REM - using generic values for Windows versions
  113. IF WIN16  SAY You are running a 16-bit version of Windows.\nYou can only run 16-bit programs.
  114. IF WFWG      SAY You are running Windows for Workgroups
  115. IF WIN32S SAY Your Windows version can run Win32s programs
  116. IF WIN32  SAY You are running a 32-bit version of Windows    
  117.  
  118. IF CPU 80386 say Your PC has got an 80386 chip
  119. IF CPU 80486 say Your PC has got an 80486 chip
  120. IF CPU P5    say Your PC has got a Pentium chip
  121.  
  122. IF HAS-FPU   say Your PC has got a Maths Co-Processor
  123.  
  124. REM --- are we fed up with this batch demo?
  125. IF CONFIRM Question2 EXIT
  126.  
  127. REM --- sundry matters, et. al.
  128. ECHO Source directory is $SOURCEDIR
  129. ECHO Target directory is $DEST
  130. ECHO Windows directory is $WINDIR
  131. ECHO System directory is $SYSDIR
  132. ECHO Temp directory is $TEMPDIR
  133.  
  134. REM --- more stuff
  135. IF INPUT "Delay how many seconds?" DELAY INPUT
  136.  
  137. REM --- disk space matters, et. al.
  138. IF DISKFREE > 100000 SAY Free Space is Greater than 100kb!
  139. IF DISKFREE < 100000000 SAY Free Space is less than 100MB!
  140. IF DISKFREE > 100000000 SAY Free Space is Greater than 100MB!
  141. IF DISKFREE < 100000 SAY Free Space is Less than 100kb!
  142. EXIT
  143.  
  144. [----- we came here because you didn't want the demo ------]
  145. :NO-DEMO
  146. SAY Well, sorry that you don't want to see my demo.\n\nThis batch file is called CHIEFPRO.CHF.\n\nYou can check it later on.\n\nBye for now ...
  147. EXIT
  148. REM - always end a label with EXIT IF you want processing
  149. REM - to end there!
  150. [--------------------------------------]
  151.  
  152. REM IF CONFIRM "Should I now exit windows?" EXITWINDOWS
  153. REM IF INPUT "Exit Windows and run what?" EXITWINDOWSEXEC INPUT
  154.  
  155.